package com.jdk.learn;

/**
 * Created by bgt on 2017/5/19.
 */
public class MyRunable implements  Runnable {
    private boolean transaction;
    private Runnable runnable;

    public void setRunnable(Runnable runnable) {
        this.runnable = runnable;
    }

    public void setTransaction(boolean transaction) {
        this.transaction = transaction;
    }

    public void run() {
        if (transaction) System.out.println("begin");
        System.out.println("具体业务");
        runnable.run();
        if (transaction) System.out.println("end");
    }
}
